# snippet  "description"

# endsnippet
snippet asn "assert_ne!()"
assert_ne!(${1:expected}, ${2:actual});$0
endsnippet

snippet uni "unimplemented!()"
unimplemented!()
endsnippet

snippet epln "eprintln!"
eprintln!("$1")$0
endsnippet

snippet epln, "eprintln!"
eprintln!("$1{$2}", $3)$0
endsnippet

snippet il "``"
\`$1\`$0
endsnippet

snippet str "str"
&'static str$0
endsnippet

snippet stt "stuct tuple"
struct ${1:StructName}(${2:i32});$0
endsnippet

snippet > "=>"
$1 => $2,$0
endsnippet

snippet arg "Function Arguments" i
${1:a}: ${2:T}${3:, arg}
endsnippet

snippet cl "Closure, anonymous function (inline)" i
${1:move }|${2}| $3
endsnippet

snippet cll "Closure, anonymous function (inline)" i
${1:move }|${2}| { $3 }
endsnippet

snippet clb "Closure, anonymous function (block)" i
${1:move }|${2}| {
	$3
}
endsnippet


snippet vec "vec!" i
vec![${1}]${2}
endsnippet
################################################################################
#                                     impl                                     #
################################################################################
snippet trait "trait structure"
pub trait ${1:Trait} {
	$0
}
endsnippet

snippet tfn "Trait Method"
fn ${1:method}(&self${2})${3}${4:;}$0
endsnippet

snippet impl "Struct/Trait implementation"
impl ${1:Type/Trait} for ${2:Type} {
	${0}
}
endsnippet

snippet impld "impl fmt::Dispaly"
impl fmt::Display for ${1:CustomType} {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "${2:\{\}}", ${3:self.0})
    }
}
endsnippet

snippet implfrom "impl From"
impl From<${1:Type}> for ${2:CustomType} {
    fn from(item: $1) -> Self {
        $0
    }
}
endsnippet

# snippet impltostring "impl ToString"
# impl ToString for ${1:CustomType} {
#     fn to_string(&self) -> String {
#         format!("${2}", $0)
#     }
# }
# endsnippet
